import {defineStore} from "pinia";
import {stateType} from "*.vue";

export const useCountState = defineStore("count",{
    state:():stateType=>{
        return {
            count:1
        }
    },
    getters:{
        doubleCount:(state):number=>{
            return state.count * 2
        }
    },
    actions:{
        addCount(){
            this.count++
        },
        addCountN(n:number){
            this.count += n
        },
        addCountWaitNM(n:number,m:number){
            setTimeout(()=>{
                this.count += n + m
            },2000)
        }
    }
})